from pml import Objects

class Stack(Objects.object.typeobject):
    def __init__(self):
        super().__init__('stack')
        self.value = []
    def __repr__(self):
        return self.value.__repr__()

    def getObject(self):
        self.methods['__init__'] = self.tp_init

        return self

    @staticmethod
    def push(frame, this: 'Stack', position, value):
        this.value.append(value)

    @staticmethod
    def pop(frame, this: 'Stack', position):
        this.value.pop()

    @staticmethod
    def top(frame, this: 'Stack', position):
        return this.value[-1]

    @staticmethod
    def clear(frame, this: 'Stack', position):
        this.value.clear()

    @staticmethod
    def tp_init(frame, this, position):
        pass

